********************************************************************************
* Crisis and the Trajectory of Science: Evidence from the 2014 Ebola Outbreak									   
*																			   *
* Caroline Fry							   *
*																			   *
* This script replicates the tables	contained in the article published in:     *
* Review of Economics and Statistics									   *
********************************************************************************

********************************************************************************
*                                Preliminaries                                 *
********************************************************************************

clear all

set matsize 11000

* Set path:
* global dir "PATH"
* cd "$dir"

capture log close








********************************************************************************
*                                    Table 1                            *
********************************************************************************


clear 
use ebola.dataset.dta  


keep if year == 2013 

bys endemiccountry: sum careerage, de
ttest careerage, by(endemiccountry)

bys endemiccountry: sum dummypub, de 
ttest dummypub, by(endemiccountry)

bys endemiccountry: sum numpubs, de 
ttest numpubs, by(endemiccountry)

bys endemiccountry: sum dummypubfirst, de 
ttest dummypubfirst, by(endemiccountry)

bys endemiccountry: sum numpubsfirst, de 
ttest numpubsfirst, by(endemiccountry)

bys endemiccountry: sum dummypublast, de 
ttest dummypublast, by(endemiccountry)

bys endemiccountry: sum numpubspi, de 
ttest numpubspi, by(endemiccountry)

bys endemiccountry: sum dummypubntd, de 
ttest dummypubntd, by(endemiccountry)

bys endemiccountry: sum numpubsntd, de 
ttest numpubsntd, by(endemiccountry)

bys endemiccountry: sum dummypuboecdcoauthor, de 
ttest dummypuboecdcoauthor, by(endemiccountry)

bys endemiccountry: sum numpubsoecdcoauthors, de 
ttest numpubsoecdcoauthors, by(endemiccountry)

bys endemiccountry: sum dummynewoecdcoauthor, de 
ttest dummynewoecdcoauthor, by(endemiccountry)

bys endemiccountry: sum numnewoecdcoauthors, de 
ttest numnewoecdcoauthors, by(endemiccountry)




********************************************************************************
*                                    Table 2                                 *
********************************************************************************


clear 
use ebola.dataset.dta 


* Specification 1a 
ppmlhdfe numpubs endemiccountrypost, absorb(careeragebin year idnumber) vce(cluster idnumber)
 
* Specification 1b
ppmlhdfe numpubs endemiccountrypost endemiccountrypostntd, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2a
ppmlhdfe nonebolapubs endemiccountrypost, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2b
ppmlhdfe nonebolapubs endemiccountrypost endemiccountrypostntd, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 3a
ppmlhdfe numpubs ebolacasesthou, absorb(careeragebin year idnumber) vce(cluster idnumber)
 
* Specification 3b
ppmlhdfe numpubs ebolacasesthou ebolacasesthountd, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 4a
ppmlhdfe nonebolapubs ebolacasesthou, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 4b
ppmlhdfe nonebolapubs ebolacasesthou ebolacasesthountd, absorb( careeragebin year idnumber) vce(cluster idnumber)




********************************************************************************
*                                    Table 3                                  *
********************************************************************************


clear 
use ebola.dataset.dta 

* Specification 1a 
ppmlhdfe numpubsoecdcoauthors endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 1b
ppmlhdfe numpubsnooecdcoauthor endemiccountrypost endemiccountrypostntd, absorb(careeragebin year idnumber) vce(cluster idnumber) 

* Specification 1c
ppmlhdfe numnewoecdcoauthors endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber) 


preserve
keep if dummyntdpubpre==1
* Specification 2a
ppmlhdfe numpubs endemiccountrypost , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2b
ppmlhdfe numpubs endemiccountrypost numpubsoecdcoauthors, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2c
ppmlhdfe numpubs endemiccountrypost numnewoecdcoauthors , absorb(careeragebin year idnumber) vce(cluster idnumber)
restore 



preserve
keep if dummyntdpubpre==0
* Specification 3a
ppmlhdfe numpubs endemiccountrypost , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 3b
ppmlhdfe numpubs endemiccountrypost numpubsoecdcoauthors, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 3c 
ppmlhdfe numpubs endemiccountrypost numnewoecdcoauthors, absorb(careeragebin year idnumber) vce(cluster idnumber)
restore 




********************************************************************************
*                                    Table 4                                   *
********************************************************************************


clear 
use ebola.dataset.dta 

preserve
drop if year == 2014 | year == 2015 | year == 2016
* Specification 1a
ppmlhdfe numpubs endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)
 
* Specification 1b 
ppmlhdfe nonebolapubs endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2a
ppmlhdfe numpubsoecdcoauthors  endemiccountrypost endemiccountrypostntd, absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 2b 
ppmlhdfe numpubsnooecdcoauthor endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 3a 
reghdfe dummypubfirst  endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)

* Specification 3b 
reghdfe dummypublast  endemiccountrypost endemiccountrypostntd , absorb(careeragebin year idnumber) vce(cluster idnumber)
restore 




